﻿Public Class frmTitleSelect
    Private Sub frmTitleSelect_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim SelectLength As Integer = (Selections.Length / 3)

        lstTitles.Items.Clear()
        lstTitles.Items.Add("No Titles Match")
        For Title As Integer = 0 To (SelectLength - 1)
            If Selections(Title, 1) <> "" Then
                lstTitles.Items.Add(Selections(Title, 0) & " - " & Selections(Title, 1).Substring(0, 4))
            Else
                lstTitles.Items.Add(Selections(Title, 0))
            End If

        Next
    End Sub

    Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
        If lstTitles.SelectedIndex <> -1 Then
            If lstTitles.SelectedIndex > 0 Then
                SelectedID(0) = Selections((lstTitles.SelectedIndex - 1), 2)
                SelectedID(1) = Selections((lstTitles.SelectedIndex - 1), 0)
                Me.Close()
            Else
                Me.Close()
            End If
        Else
            MessageBox.Show("Please Select a Title to Continue")
        End If
    End Sub

    Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub
End Class